﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MediatR;
using W.Warehouse.Api.Application.Command.OutboundCommand;
using Microsoft.AspNetCore.Authorization;
using W.Warehouse.Domain.DTO;
namespace W.Warehouse.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    //[Authorize]
    public class OutboundController : ControllerBase
    {
        private readonly IMediator mediator;

        public OutboundController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 出库多条添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns>返回影响行数</returns>
        [HttpPost]
        public async Task<int> OutboundAdd(OutboundAddCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 出库反填
        /// </summary>
        /// <param name="command"></param>
        /// <returns>返回集合</returns>
        [HttpPost]
        public async Task<List<OutboundDTO>> OutboundFan(OutboundFanCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 出库多修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns>返回影响行数</returns>
        [HttpPost]
        public async Task<int> OutboundUpdate(OutboundUpdateCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 出库多条删除
        /// </summary>
        /// <param name="command"></param>
        /// <returns>返回影响行数</returns>
        [HttpPost]
        public async Task<int> OutboundDelete(OutboundDeleteCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 出库多条批量删除
        /// </summary>
        /// <param name="command"></param>
        /// <returns>返回影响行数</returns>
        [HttpPost]
        public async Task<int> OutboundIsdelAll(OutboundIsdelAllCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
